package com.jdew.thkj.fragment;

import com.jdew.thkj.base.BaseFragment;

import java.util.HashMap;

/**
 * Fragment工厂类。
 * Created by LW on 2017/4/20.
 */

public class FragmentFactory {

    public static BaseFragment createFragment(int pos) {
        HashMap<Integer, BaseFragment> mBaseFragments = new HashMap<Integer, BaseFragment>();
        BaseFragment baseFragment = mBaseFragments.get(pos);
        if (baseFragment == null) {
            switch (pos) {
                case 0:
                    baseFragment = new SeniorMemberFragment();
                    //直属教练
                    break;
                case 1:
                    baseFragment = new MyHuiFansFragment();
                    //所有惠粉
                    break;
                default:
                    break;
            }
            mBaseFragments.put(pos, baseFragment);
        }
        return baseFragment;
    }

    public static BaseFragment createFragment2(int pos) {
        HashMap<Integer, BaseFragment> mBaseFragments = new HashMap<Integer, BaseFragment>();
        BaseFragment baseFragment = mBaseFragments.get(pos);
        if (baseFragment == null) {
            switch (pos) {
                case 0:
                    baseFragment = new MySuperFansFragment();
                    //直属教练
                    break;
                case 1:
                    baseFragment = new SeniorMemberFragment();
                    //高级惠员
                    break;
                case 2:
                    baseFragment = new MyHuiFansFragment();
                    //所有惠粉
                    break;
                default:
                    break;
            }
            mBaseFragments.put(pos, baseFragment);
        }
        return baseFragment;
    }

    public static BaseFragment createFragment3(int pos) {
        HashMap<Integer, BaseFragment> mBaseFragments = new HashMap<Integer, BaseFragment>();
        BaseFragment baseFragment = mBaseFragments.get(pos);
        if (baseFragment == null) {
            switch (pos) {
                case 0:
                    baseFragment = new SelectFragment();
                    //为你精选
                    break;
                case 1:
                    baseFragment = new NewestFragment();
                    //最新上架
                    break;
                case 2:
                    baseFragment = new HotFragment();
                    //人气热销
                    break;
                default:
                    break;
            }
            mBaseFragments.put(pos, baseFragment);
        }
        return baseFragment;
    }

    public static BaseFragment createFragment4(int pos, String position) {
        HashMap<Integer, BaseFragment> mBaseFragments = new HashMap<Integer, BaseFragment>();
        BaseFragment baseFragment = mBaseFragments.get(pos);
        if (baseFragment == null) {
            switch (pos) {
                case 0:
                    if (position.equals("tb")) {
                        baseFragment = new OrderAllFragment();
                    } else {
                        baseFragment = new JDOrderAllFragment();
                    }
                    break;
                case 1:
                    if (position.equals("tb")) {
                        baseFragment = new OrderPaidFragment();
                    } else {
                        baseFragment = new JDOrderPaidFragment();
                    }
                    break;
                case 2:
                    if (position.equals("tb")) {
                        baseFragment = new OrderSettledFragment();
                    } else {
                        baseFragment = new JDOrderSettledFragment();
                    }
                    break;
                case 3:
                    if (position.equals("tb")) {
                        baseFragment = new OrderFailedFragment();
                    } else {
                        baseFragment = new JDOrderFailedFragment();
                    }
                    break;
                default:
                    break;
            }
            mBaseFragments.put(pos, baseFragment);
        }
        return baseFragment;
    }

    public static BaseFragment createFragment5(int pos) {
        HashMap<Integer, BaseFragment>  mBaseFragments = new HashMap<Integer, BaseFragment>();
        BaseFragment baseFragment = mBaseFragments.get(pos);
        if (baseFragment == null) {
            switch (pos) {
                case 0:
                    baseFragment = new TodayFragment();
                    //今日
                    break;
                case 1:
                    baseFragment = new YestodayFragment();
                    //昨日
                    break;
                default:
                    break;
            }
            mBaseFragments.put(pos, baseFragment);
        }
        return baseFragment;
    }

    public static BaseFragment createFragment6(int pos) {
        HashMap<Integer, BaseFragment> mBaseFragments = new HashMap<Integer, BaseFragment>();
        BaseFragment baseFragment = mBaseFragments.get(pos);
        if (baseFragment == null) {
            switch (pos) {
                case 0:
                    baseFragment = new HomeListFragment();
                    //热门
                    break;
                case 1:
                    baseFragment = new Fragment2();
                    baseFragment.key="16";
                    break;
                case 2:
                    baseFragment = new Fragment2();
                    baseFragment.key="35";
                    break;
                case 3:
                    baseFragment = new Fragment2();
                    baseFragment.key="21";
                    break;
                case 4:
                    baseFragment = new Fragment2();
                    baseFragment.key="30";
                    break;
                case 5:
                    baseFragment = new Fragment2();
                    baseFragment.key="50006842";
                    break;
                case 6:
                    baseFragment = new Fragment2();
                    baseFragment.key="20";
                    break;
                case 7:
                    baseFragment = new Fragment2();
                    baseFragment.key="50002766";
                    break;
                case 8:
                    baseFragment = new Fragment2();
                    baseFragment.key="1625";
                    break;
                case 9:
                    baseFragment = new Fragment2();
                    baseFragment.key="50010788";
                    break;
                case 10:
                    baseFragment = new Fragment2();
                    baseFragment.key="50010404";
                    break;
                default:
                    break;
            }
            mBaseFragments.put(pos, baseFragment);
        }
        return baseFragment;
    }

    public static BaseFragment createFragment7(int pos) {
        HashMap<Integer, BaseFragment> mBaseFragments = new HashMap<Integer, BaseFragment>();
        BaseFragment baseFragment = mBaseFragments.get(pos);
        if (baseFragment == null) {
            switch (pos) {
                case 0:
                    baseFragment = new ProductAreaFragment();
                    //商品区
                    break;
                case 1:
                    baseFragment = new MaterialAreaFragment();
                    //素材区
                    break;
                case 2:
                    baseFragment = new AttractInvestmentAreaFragment();
                    //招商区
                    break;
                default:
                    break;
            }
            mBaseFragments.put(pos, baseFragment);
        }
        return baseFragment;
    }
}
